var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, n) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var n in t)
              Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
          })(t, n);
      };
      return function (t, n) {
        function o() {
          this.constructor = t;
        }
        if ("function" != typeof n && null !== n)
          throw new TypeError(
            "Class extends value " + String(n) + " is not a constructor or null"
          );
        e(t, n),
          (t.prototype =
            null === n
              ? Object.create(n)
              : ((o.prototype = n.prototype), new o()));
      };
    })(),
  AXModifyNameDialog = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        (t.onLoadModifyNameDataFn = {
          caller: t,
          code: 1003,
          method: function (e) {
            0 == e.code
              ? (ToastView.toastView(t.text_new_nickName.text + e.data),
                Laya.stage.event("HomePageView", {
                  code: "username",
                  data: t.text_new_nickName.text,
                }),
                Laya.stage.event("GameMainView", {
                  code: "username",
                  data: t.text_new_nickName.text,
                }),
                (Global.roleName = t.text_new_nickName.text),
                t.close())
              : ToastView.toastView(e.msg);
          },
        }),
        t.btn_setnickName_sure.on(
          Laya.Event.CLICK,
          t,
          t.onActionSetNewNickNameFn
        ),
        WebSocketService.addListener(t.onLoadModifyNameDataFn),
        t
      );
    }
    return (
      __extends(t, e),
      (t.shwoModifyView = function () {
        null == this.modifyName &&
          ((this.modifyName = new t()), (this.modifyName.zOrder = 1e3)),
          this.modifyName.popup(!1),
          (this.modifyName.text_new_nickName.text = "");
      }),
      (t.prototype.onActionSetNewNickNameFn = function () {
        this.text_new_nickName.text.length <= 0 ||
          (-1 == this.text_new_nickName.text.indexOf(" ")
            ? WebSocketService.send({
                c: 1003,
                d: { name: this.text_new_nickName.text },
              })
            : ToastView.toastView("用户名输入不能包含空格"));
      }),
      (t.close = function () {
        this.modifyName && (this.modifyName = null);
      }),
      (t.prototype.close = function (t) {
        "side" != t && e.prototype.close.call(this, t);
      }),
      t
    );
  })(ui.UserInfoController.AXModifyNameDialogUI);
